package com.byl.modules.core.controller;

import com.byl.common.modules.controller.BaseController;
import com.byl.modules.core.service.LoanService;
import com.byl.sdk.bean.ResultBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/api/loan")
public class LoanController extends BaseController {

    @Autowired
    LoanService loanService;

    @PostMapping("/save")
    public String save(@RequestBody Map map){
        int rs=loanService.save(map);
        return rs>0? success("创建成功!"):fail("创建失败!");
    }

    @PostMapping("/list")
    public String query(@RequestBody Map map){
        ResultBean bean=loanService.query(map);
        return success("贷款单列表",bean);
    }

    @PostMapping("/applysuccess")
    public String applySuccess(@RequestBody Map map){
        int rs=loanService.applySuccess(map);
        return rs>0?success("操作成功!"):fail("操作失败!");
    }


}
